<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>JavaScript Const</title>
</head>
<body>
<h2>常量数组可以更改</h2>

<p id="demo"></p>
<script>
  // 创建数组：
  const cars=["Audi","BMW","Porsche"];

  // 更改元素：
  cars[0]="Toyota";

  // 添加元素：
  cars.push("Honda");

  // 显示数组：
  document.getElementById("demo").innerHTML=cars;
</script>
</body>
</html>
<!--
但是无法重新为常量数组赋值：
const cars = ["Audi", "BMW", "porsche"];
cars = ["Honda", "Toyota", "Volvo"];    // ERROR
-->